-
Notifications
You must be signed in to change notification settings - Fork 7.6k
getNextFileName: Get info wether filename is a file or directory #8068
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
tueddy seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks for contribution @tueddy :)
Please submit the CLA to be able to merge this.
@P-R-O-C-H-Y Thank's for approving! |
libraries/FS/src/vfs_api.cpp
Outdated
// check entry is a directory | ||
if(isDir) { | ||
*isDir = (file->d_type == DT_DIR); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That check is good for sure. Can you just remove the spaces before the part so its aligned with other code?
@tueddy Seems that CLA is still not signed yet. |
I suspect it's because the first of your three commits still has the wrong author/e-mail. You should probably squash the commits into one and fix the authorship. |
That should help. You can do squash yourself on your branch so you will still be the author :) |
@tueddy If there is still a problem, it will be faster to close this PR, create new branch and copy the changes there. After that open new PR and ping me to comment and I will approve it ASAP :) |
I will close here & open a new PR.. |
Hi Arduino-ESP32 team,
the FS function
getNextFilename()
has been merged since 2.0.6 and speeds-up directory listing by factor >20 (many files on SD-card).Thank's for this improvement!
Unfortunately, this function can only be used to a limited extent because it is not possible to distinguish whether the returned name is a file or a directory. This may have been overlooked in PR #7229 , see discussion.
A concrete use case is an SD card web server that delivers a JSON file/directory structure for given path.
I have overloaded the function with a new return parameter isDir. This returns true if it is a directory:
Changes are minimal & this PR should be fully backwards compatible.
Thank's
Dirk
Directory listing in the browser with
openNextFile()
. Loading one directory-level takes 2s:Directory listing in the browser with
getNextFileName(boolean *isDir)
. Loading one directory-level takes 20ms: